home *** CD-ROM | disk | FTP | other *** search
- Path: gate.bronson.com!usenet
- From: SWade@bronson.com (Scott Wade)
- Newsgroups: comp.lang.c++,comp.os.ms-windows.programmer.win32
- Subject: Re: MFC and console apps
- Date: Tue, 30 Jan 1996 16:57:20 GMT
- Organization: Bronson, Bronson and McKinnon
- Message-ID: <4eli9l$2r1@gate.bronson.com>
- References: <4ejfsi$h5s@gate.bronson.com> <4ek6jp$k3g@Venus.mcs.com>
- NNTP-Posting-Host: romulus.bronson.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- marcr@MCS.COM (Marc Rossi) wrote:
-
- >: New to MFC and wondering whether it's possible to use MFC classes in a
- >: CONSOLE app?
-
- >I had the same question about a week ago, wanting to use the DAO classes
- >in MFC for a console app. According to MS (at least according to the
- >MS support person I spoke with) it is possible to write a console app
- >using MFC but it is not a recommended procedure. Some of the MFC classes
- >make references to classes that would only have been instantiated if
- >you were running a Windowed app, such as a CWinApp object. MS suggested
- >creating a dummy CWinApp instance if I really needed to use MFC. I passed
- >on the suggestion (sounds like a kludge to me). FYI, I was unable to use
- >DAO without having a MFC dependency (the DAO SDK on the VC CD has MFC
- >dependencies).
-
- Thanks for the info....my main problem was the linkage errors
- generated when building an .exe from a console app that makes use
- of various MFC Classes (none of the instantiated only under a CWinApp
- instance classes). Linkage wanted externals:
-
- _endthreadex (from nafxcwd.lib) and
- _beginthreadex (from nafxcwd.lib)
-
- coming from the inclusion of <afx.h>.
-
- Finally found the problem.....using a new console app project defaults
- to no MFC support. By defining _AFXDLL (/D "_AFXDLL") the code was
- dynamically linked with the MFC DLL and proper linkage occured with no
- errors.
-
- ---------------------------------------------------------------
- __ MIS Department
- (_ _ _ -+--+- | | _. _| _ Bronson, Bronson & McKinnon
- __)|_ |_| | | |/\|(_|(_|(/_ 505 Montgomery Street
- ================================ San Francisco CA 94111-2514
- "Our OS which art in CPU, Phone: (415) 986-4200
- Unix be thy name..." Fax: (415) 982-1394
-
- -----------------------< SWade@bronson.com >-------------------
-
-